package com.teyao.teyao_back.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teyao.teyao_back.entity.ClientInfo;
import com.teyao.teyao_back.entity.ResponseMessage;
import com.teyao.teyao_back.mapper.ClientInfoMapper;
import com.teyao.teyao_back.service.ClientInfoService;
import org.springframework.stereotype.Service;

@Service
public class ClientInfoImpl extends ServiceImpl<ClientInfoMapper, ClientInfo> implements ClientInfoService {
    public ResponseMessage myExists(Integer userId) {
        ResponseMessage responseMessage = new ResponseMessage();
        QueryWrapper<ClientInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        if (baseMapper.exists(queryWrapper)) {
            responseMessage.setSuccess(true);
        } else {
            responseMessage.setSuccess(false);
        }
        return responseMessage;
    }
}
